package org.activequant.calendar;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.TimeZone;

public class USMarketsHolidayCalendarSettings implements IHolidayCalendarSettings {
	/**
	 * private static final TimeZone TIMEZONE = TimeZone.getTimeZone("EST");
	 */
	private static final TimeZone TIMEZONE = NASDAQCalendarSettings.getInstance().getTimeZone();//"GMT-4:00"

	private static final long serialVersionUID = 3441754329515158380L;
	/**
	 * private static final FGBLHolidayCalendarSettings holidayCalendarSettings = new FGBLHolidayCalendarSettings();
	 */
	private static final USMarketsHolidayCalendarSettings holidayCalendarSettings = new USMarketsHolidayCalendarSettings();

	/**
	 * Gets a instance for the holiday calendar settings<br/>
	 * returns the associated holidayCalendarSettings(FGBLHolidayCalendarSettings)
	 * @return the instance for the settings
	 */
	public static synchronized USMarketsHolidayCalendarSettings getInstance() {
		return holidayCalendarSettings;
	}
	/**
	 * an empty private FGBLHolidayCalendarSettings (implements IHolidayCalendarSettings) constructor
	 */
	private USMarketsHolidayCalendarSettings() {
		// Instantiation not allowed
	}
	/**
	 * returns a List&lt;HolidayCalendarEntry&gt; defining HolidayCalendarEntries for recurring (fixed date) and varying holidays 
	 */
	public final List<HolidayCalendarEntry> getHolidays() {
		final ArrayList<HolidayCalendarEntry> list = new ArrayList<HolidayCalendarEntry>();

		final int asOfYear = 2001;

		// Recurring fixed date holidays (All years)
		list.add(new HolidayCalendarEntry(asOfYear, Calendar.JANUARY, 1, TIMEZONE));
		
				
		//Martin Luther King, Jr. Day
		list.add(new HolidayCalendarEntry(2009, 2009, Calendar.JANUARY, 19, TIMEZONE));
		list.add(new HolidayCalendarEntry(2010, 2010, Calendar.JANUARY, 18, TIMEZONE));
		list.add(new HolidayCalendarEntry(2011, 2011, Calendar.JANUARY, 17, TIMEZONE));
		
		
		//Washington's Birthday/Presidents' Day
		list.add(new HolidayCalendarEntry(2009, 2009, Calendar.FEBRUARY, 16, TIMEZONE));
		list.add(new HolidayCalendarEntry(2010, 2010, Calendar.FEBRUARY, 15, TIMEZONE));
		list.add(new HolidayCalendarEntry(2011, 2011, Calendar.FEBRUARY, 21, TIMEZONE));
		
		
		//Good Friday
		list.add(new HolidayCalendarEntry(2009, 2009, Calendar.APRIL, 10, TIMEZONE));
		list.add(new HolidayCalendarEntry(2010, 2010, Calendar.APRIL, 2, TIMEZONE));
		list.add(new HolidayCalendarEntry(2011, 2011, Calendar.APRIL, 22, TIMEZONE));
		
		//Memorial Day
		list.add(new HolidayCalendarEntry(2009, 2009, Calendar.MAY, 25, TIMEZONE));
		list.add(new HolidayCalendarEntry(2010, 2010, Calendar.MAY, 31, TIMEZONE));
		list.add(new HolidayCalendarEntry(2011, 2011, Calendar.MAY, 30, TIMEZONE));
		
		//Independence Day
		list.add(new HolidayCalendarEntry(2009, 2009, Calendar.JULY, 3, TIMEZONE));
		list.add(new HolidayCalendarEntry(2010, 2010, Calendar.JULY, 5, TIMEZONE));
		list.add(new HolidayCalendarEntry(2011, 2011, Calendar.JULY, 4, TIMEZONE));
		
		//Labor Day
		list.add(new HolidayCalendarEntry(2009, 2009, Calendar.SEPTEMBER, 7, TIMEZONE));
		list.add(new HolidayCalendarEntry(2010, 2010, Calendar.SEPTEMBER, 6, TIMEZONE));
		list.add(new HolidayCalendarEntry(2011, 2011, Calendar.SEPTEMBER, 5, TIMEZONE));
						
		//Thanksgiving Day
		list.add(new HolidayCalendarEntry(2009, 2009, Calendar.NOVEMBER, 26,(13*60)*60*1000L, (23*60)*60*1000L, TIMEZONE));
		list.add(new HolidayCalendarEntry(2010, 2010, Calendar.NOVEMBER, 25,(13*60)*60*1000L, (23*60)*60*1000L, TIMEZONE));
		list.add(new HolidayCalendarEntry(2011, 2011, Calendar.NOVEMBER, 24, (13*60)*60*1000L, (23*60)*60*1000L,TIMEZONE));
				
		//Christmas
		list.add(new HolidayCalendarEntry(2009, 2009, Calendar.DECEMBER, 25,(13*60)*60*1000L, (23*60)*60*1000L, TIMEZONE));
		list.add(new HolidayCalendarEntry(2010, 2010, Calendar.DECEMBER, 24, TIMEZONE));
		list.add(new HolidayCalendarEntry(2011, 2011, Calendar.DECEMBER, 26, TIMEZONE));
		
		return list;
	}
	/**
	 * returns the associated TIMEZONE(TimeZone) (TimeZone.getTimeZone("EST"))
	 */
	public TimeZone getTimeZone() {
		return TIMEZONE;
	}
}
